package com.lframework.xingyun.basedata.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lframework.xingyun.basedata.entity.ArmySaleOrder;
import com.lframework.xingyun.basedata.mappers.ArmySaleOrderMapper;
import com.lframework.xingyun.basedata.service.IArmySaleOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lframework.xingyun.core.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.lframework.xingyun.core.utils.DateUtils.yyyyMMdd;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author bogewang
 * @since 2024-09-29
 */
@Service
public class ArmySaleOrderServiceImpl extends ServiceImpl<ArmySaleOrderMapper, ArmySaleOrder> implements IArmySaleOrderService {
    @Autowired
    private ArmySaleOrderMapper armySaleOrderMapper;
    @Override
    public List<ArmySaleOrder> selectByDs(String ds, String customerName) {
        LambdaQueryWrapper<ArmySaleOrder> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(ArmySaleOrder::getDate, DateUtils.dateTime(yyyyMMdd, ds));
        if (StringUtils.isNotBlank(customerName)) {
            wrapper.eq(ArmySaleOrder::getCustomer, customerName);
        }
        return armySaleOrderMapper.selectList(wrapper);
    }
}
